package br.com.firula.util;

import java.security.MessageDigest;

public class Md5 {
	
	// GERA HASH MD5 DO SEED
	public static String getHash(String seed){
		//System.out.println("getHash");
		MessageDigest md5 = null;
		
		try {
			md5 = MessageDigest.getInstance("MD5");
		} catch (Exception e) {
			e.printStackTrace();
		}
		
		byte[] array = md5.digest(seed.getBytes());
		StringBuffer sb = new StringBuffer();
		for (int j = 0; j < array.length; ++j) {
			int b = array[j] & 0xFF;
			if (b < 0x10) sb.append('0');
			sb.append(Integer.toHexString(b) );
		}
		return sb.toString();
	}
}
